﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Data;
using System.Collections.ObjectModel;

namespace University.Workshop.Tests
{


    /// <summary>
    ///This is a test class for AnalysisReportControlTest and is intended
    ///to contain all AnalysisReportControlTest Unit Tests
    ///</summary>
    [TestClass()]
    public class AnalysisReportControlTest
    {


        private TestContext testContextInstance;
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        
        [TestMethod()]
        public void GenerateQueryTestMostSaled()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now;
            string typeProduct = "General";
            string typeSearch = "Mas Vendido";
            DataTable expected = new DataTable() { Locale = System.Globalization.CultureInfo.CurrentCulture };
            DataTable actual;
            actual = AnalysisReportControl.GenerateQuery(dateStar, dateEnd, typeProduct, typeSearch);
            Assert.AreNotEqual(expected, actual);
            Assert.AreNotEqual(0, actual.Rows.Count);

        }
        [TestMethod()]
        public void GenerateQueryTestMostSaledByType()
        {
            DateTime dateStar = DateTime.Now.AddYears(-4);
            DateTime dateEnd = DateTime.Now.AddYears(4);
            string typeProduct = "Tableta";
            string typeSearch = "Mas Vendido";
            DataTable expected = new DataTable() { Locale = System.Globalization.CultureInfo.CurrentCulture };
            DataTable actual;
            actual = AnalysisReportControl.GenerateQuery(dateStar, dateEnd, typeProduct, typeSearch);
            Assert.AreNotEqual(expected, actual);
            Assert.AreNotEqual(0, actual.Rows.Count);

        }

        [TestMethod()]
        public void GenerateQueryTestLessSaled()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now;
            string typeProduct = "General";
            string typeSearch = "Menos Vendido";
            DataTable expected = new DataTable() { Locale = System.Globalization.CultureInfo.CurrentCulture };
            DataTable actual;
            actual = AnalysisReportControl.GenerateQuery(dateStar, dateEnd, typeProduct, typeSearch);
            Assert.AreNotEqual(expected, actual);
            

        }
        [TestMethod()]
        public void GenerateQueryTestLeesSaledByType()
        {
            DateTime dateStar = DateTime.Now.AddYears(-4);
            DateTime dateEnd = DateTime.Now.AddYears(4);
            string typeProduct = "Jarabe";
            string typeSearch = "Menos Vendido";
            DataTable expected = new DataTable() { Locale = System.Globalization.CultureInfo.CurrentCulture };
            DataTable actual;
            actual = AnalysisReportControl.GenerateQuery(dateStar, dateEnd, typeProduct, typeSearch);
            Assert.AreNotEqual(expected, actual);
          

        }

        [TestMethod()]
        public void GenerateQueryTestTypeLessSaled()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now;
            string typeProduct = "Resfrianex";
            string typeSearch = "Menos Vendido";
            DataTable expected = new DataTable() { Locale = System.Globalization.CultureInfo.CurrentCulture };
            DataTable actual;
            actual = AnalysisReportControl.GenerateQuery(dateStar, dateEnd, typeProduct, typeSearch);
            Assert.AreNotEqual(expected, actual);
        }

        [TestMethod()]
        public void GenerateQueryTestTypeMostSaled()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now;
            string typeProduct = "Resfrianex";
            string typeSearch = "Mas Vendido";
            DataTable expected = new DataTable() { Locale = System.Globalization.CultureInfo.CurrentCulture };
            DataTable actual;
            actual = AnalysisReportControl.GenerateQuery(dateStar, dateEnd, typeProduct, typeSearch);
            Assert.AreNotEqual(expected, actual);


        }


        [TestMethod()]
        public void ReportsTestGeneralMostSaled()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now;
            string product = "General";
            string search = "Mas Vendido";
            bool expected = true;
            bool actual;
            actual = AnalysisReportControl.Reports(dateStar, dateEnd, product, search);
            Assert.AreEqual(expected, actual);

        }
        [TestMethod()]
        public void ReportsTestTabletMostSaled()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now;
            string product = "Jarabe";
            string search = "Mas Vendido";
            bool expected = true;
            bool actual;
            actual = AnalysisReportControl.Reports(dateStar, dateEnd, product, search);
            Assert.AreEqual(expected, actual);

        }
        [TestMethod()]
        public void ReportsTestTabletLessSaled()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now;
            string product = "Jarabe";
            string search = "Menos Vendido";
            bool expected = true;
            bool actual;
            actual = AnalysisReportControl.Reports(dateStar, dateEnd, product, search);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ReportsTestGeneralLessSaled()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now;
            string product = "General";
            string search = "Menos Vendido";
            bool expected = true;
            bool actual;
            actual = AnalysisReportControl.Reports(dateStar, dateEnd, product, search);
            Assert.AreEqual(expected, actual);

        }
        [TestMethod()]
        public void ReportsTestByTypelMostSaled()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now;
            string product = "Aspirina";
            string search = "Mas Vendido";
            bool expected = true;
            bool actual;
            actual = AnalysisReportControl.Reports(dateStar, dateEnd, product, search);
            Assert.AreEqual(expected, actual);

        }
        [TestMethod()]
        public void ReportsTestByTypelLessSaled()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now;
            string product = "Aspirina";
            string search = "Menos Vendido";
            bool expected = true;
            bool actual;
            actual = AnalysisReportControl.Reports(dateStar, dateEnd, product, search);
            Assert.AreEqual(expected, actual);

        }


        
        [TestMethod()]
        public void GenerateListProductTest()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now; 
            Collection<string> expected = null; 
            Collection<string> actual;
            actual = AnalysisReportControl.GenerateList(dateStar, dateEnd);
            Assert.AreNotEqual(expected, actual);
            
        }

        [TestMethod()]
        public void GenerateListProductInRangeDateTest()
        {
            DateTime dateStar = DateTime.Now.AddYears(-1);
            DateTime dateEnd = DateTime.Now; 
            Collection<string> expected = null; 
            Collection<string> actual;
            actual = AnalysisReportControl.GenerateListProduct(dateStar, dateEnd);
            Assert.AreNotEqual(expected, actual);
           
        }
    }
}
